package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
@Getter@Setter
public class StrategyComment extends BaseDomain{
    public final static int STATE_NORMAL=0;//正常

    public final static int STATE_DISABLE=-1;//禁用

    public final static int STATE_COMMENT=1;//推荐

    private User user;//评论人
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;//评论时间

    private String content;//评论内容

    private String imgUrls;//评论图片

    private Integer starNum;//星星数量

    private Strategy strategy;//大攻略

    private Integer state=STATE_NORMAL;//状态(默认状态为正常状态)

    private Date commendTime;//推荐时间

    //将图片路径分割到数组中
    public String[] getImgArr(){
        if(imgUrls != null){
            String[] imgs = imgUrls.split(";");
            return imgs;
        }
        return null;
    }
}